/*
 * Undoable.java
 *
 * Created on October 29, 2006, 6:15 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package edu.umn.cs5115.scheduler.framework;

/**
 * Classes which implement this interface should be able to invoke a method to
 * undo something that was being done as they were created and registered with
 * the undo manager.
 * @author grant
 */
public abstract class Undoable
{
    /**
     * Undoes some action by calling the appropriate methods to reverse the 
     * original effect of the action.  These methods should re-register an
     * undo with the UndoManager to allow redo to work.
     */
    public abstract void undo();
    
    /**
     * Tests to see if the undoable is valid.  If it is not valid when it comes
     * to the top of the undo or redo stack it will be thrown away.
     * Note: if you do something that may cause undo items on the top of the
     * stack to suddenly become invalid, you may call validateUndoItems() on the
     * undo manager to force this test.
     * @return True if the undo is valid, and should be kept, false if it should
     * be thrown away at the next validation.
     */
    public boolean isValid()
    {
        return true;
    }
}
